<!DOCTYPE html><html lang="en"><head>	<meta charset="UTF-8">	<title>029-用Promise处理DOM事件.html</title></head><body>	</body><script type="text/javascript">	//1.需要一个生成promise对象的函数	const getImagePromise = (src)=>new Promise((resolve,reject)=>{		//有异步处理逻辑		const img = new image()		img.onload = function(){			resolve(src+'img loaded success!')		}		img.onerror = function(){			reject(src+'img loaded error')		}		img.src = src	})	//2.用函数生成promise	// const getImagePromise = (src)=>new Promise((resolve,reject)=>{	// 	const img = new Image()	// 	img.onload = function(){	// 		resolve(src+'img loaded success!')	// 	}	// 	img.onerror = function(){	// 		reject(src +'img loaded error!')	// 	}	// 	img.src = src 	// })	//	getImagePromise('./')	.then(data=>{		console.log(data)	})	.catch(err=>{		console.log(err)	})</script></html>